
<template name='ai_header'>

	<view class="body ">
		<view class="dashboard">
			<header>
				<h1>AI智能大数据目录管理系统</h1>
				<p class="subtitle">基于人工智能与大数据的智能目录管理解决方案</p>
			</header>

			<div class="controls-panel">
				
				<!-- 功能2：重置商品目录 -->
				<div class="control-card">
					<div class="card-header">
						<div class="icon">🔄</div>
						<h2>重置商品目录</h2>
					</div>
					<p class="description">将商品恢复到无目录初始状态，清除所有自定义分类和设置。此操作会保留商品基本信息，重置分类关系但会保留分类，适用于目录结构重构场景。如果需要删除分类请操作【删除空白目录】。</p>
					<view @click="deleteGoodsHeader()" class="btn">执行重置操作</view>
				</div>
				
				<!-- 功能1：删除空白目录 -->
				<div class="control-card">
					<div class="card-header">
						<div class="icon">🗑️</div>
						<h2>删除空白目录</h2>
					</div>
					<p class="description">利用AI算法智能识别并删除系统中的空白目录，释放存储空间，优化目录结构。系统会分析目录使用情况，确保不会误删重要目录。</p>
					<view @click="DeleteEmptyDirectoryOrHeaderAndCount0()" class="btn">执行删除操作</view>
				</div>
				

				<!-- 功能3：智能创建分类 -->
				<div class="control-card">
					<div class="card-header">
						<div class="icon">🧠</div>
						<h2>智能创建分类</h2>
					</div>
					<p class="description">基于AI分析商品属性、销售数据和用户行为，自动创建最优的商品分类体系。系统会考虑多种因素，确保分类既合理又便于管理。</p>
					<view @click="goodsAiToHeaderList1" class="btn">执行创建操作</view>
				</div>
			
			</div>
			
		
		</view>
		
	</view>
	

</template>

<script>
	export default{
		name:'ai_header',
		data(){
			return{

			}
		},
		methods:{
			//分类- 把所有的商品进行获取分类，第一步(重置分类)
			DeleteEmptyDirectoryOrHeaderAndCount0(callback=null){
				var that = this
				that.$common.get_request(
					{
						type: 'DeleteEmptyDirectoryOrHeaderAndCount0',
					},
					(res)=>{
						if(callback!=null){
							callback()
						}
						that.$common.showModal('提示',res.msg)
					},()=>{},true,"","请不要关闭此窗口(初始化分类中...)",0,180000
				);
			},
			
			//分类- 把所有的商品进行获取分类，第一步(重置分类)
			deleteGoodsHeader(callback=null){
				var that = this
				that.$common.get_request(
					{
						type: 'deleteGoodsHeader',
					},
					(res)=>{
						if(callback!=null){
							callback()
						}
						that.$common.showModal('提示',res.msg)
					},()=>{},true,"","请不要关闭此窗口(初始化分类中...)",0,180000
				);
			},
			
			
			//分类- 把所有的商品进行获取分类，第二步(创建新的分类) status: 1=成功操作 2=没有更多了 3=重新尝试接口
			goodsAiToHeaderList1(){
				var that = this
				uni.showLoading({
					title: "加载中...",
					mask: true,
				});
				that.$common.get_request(
					{
						type: 'goodsAiToHeaderList1',
					},
					(res)=>{
						if(res.status == 1 || res.status == 3){
							that.goodsAiToHeaderList1()
							return;
						}
						
						if(res.status == 2){
							that.$common.showModal('提示',res.msg)
							return;
						}
					},()=>{},true,"","请不要关闭此窗口(创建分类...)",0,180000
				);
			},
			
		}
	}
</script>

<style>
	.body {
		background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
		color: #e0e0e0;
		display: flex;
		justify-content: center;
		align-items: center;
		padding: 20px;
		height: calc(100% - 40px);
	}
	.dashboard {
		width: 100%;
		max-width: 1200px;
		background: rgba(255, 255, 255, 0.05);
		border-radius: 20px;
		padding: 30px;
		height: calc(100% - 60px);
		box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
		border: 1px solid rgba(255, 255, 255, 0.1);
		backdrop-filter: blur(10px);
	}
        
	header {
		text-align: center;
		margin-bottom: 30px;
		padding-bottom: 20px;
		border-bottom: 1px solid rgba(255, 255, 255, 0.1);
	}
	
	h1 {
		font-size: 2.2rem;
		margin-bottom: 10px;
		background: linear-gradient(to right, #4facfe, #00f2fe);
		-webkit-background-clip: text;
		background-clip: text;
		color: transparent;
	}
	
	.subtitle {
		font-size: 1rem;
		opacity: 0.8;
	}
	
	.controls-panel {
		display: grid;
		grid-template-columns: repeat(3, 1fr);
		gap: 25px;
	}
	
	.control-card {
		background: rgba(255, 255, 255, 0.05);
		border-radius: 15px;
		padding: 25px;
		transition: all 0.3s ease;
		border: 1px solid rgba(255, 255, 255, 0.1);
		height: auto;
		display: flex;
		flex-direction: column;
	}
	
	.control-card:hover {
		transform: translateY(-5px);
		background: rgba(255, 255, 255, 0.08);
		box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
	}
	
	.card-header {
		display: flex;
		align-items: center;
		margin-bottom: 15px;
	}
	
	.icon {
		font-size: 2.2rem;
		margin-right: 15px;
		color: #00f2fe;
	}
	
	h2 {
		font-size: 1.3rem;
		color: #fff;
	}
	
	.description {
		font-size: 0.9rem;
		line-height: 1.5;
		margin-bottom: 20px;
		opacity: 0.9;
		flex-grow: 1;
	}
	
	.btn {
		display: inline-block;
		padding: 10px 20px;
		background: linear-gradient(to right, #4facfe, #00f2fe);
		color: #fff;
		border: none;
		border-radius: 25px;
		font-size: 0.9rem;
		font-weight: 600;
		cursor: pointer;
		transition: all 0.3s ease;
		text-align: center;
		text-decoration: none;
		/* width: 100%; */
		position: relative;
		overflow: hidden;
	}
	
	.btn::after {
		content: '';
		position: absolute;
		top: 50%;
		left: 50%;
		width: 0;
		height: 0;
		background: rgba(255, 255, 255, 0.2);
		border-radius: 50%;
		transition: all 0.5s ease;
		transform: translate(-50%, -50%);
	}
	
	.btn:hover::after {
		width: 300px;
		height: 300px;
	}
	
	.btn:active {
		transform: scale(0.98);
	}
	
	footer {
		text-align: center;
		margin-top: 30px;
		padding-top: 20px;
		border-top: 1px solid rgba(255, 255, 255, 0.1);
		font-size: 0.8rem;
		opacity: 0.6;
	}
	
	/* 响应式调整 */
	@media (max-width: 768px) {
		.controls-panel {
			grid-template-columns: 1fr;
		}
		
		h1 {
			font-size: 1.8rem;
		}
		
		.dashboard {
			padding: 20px;
		}
	}
	
	@media (max-width: 480px) {
		.card-header {
			flex-direction: column;
			text-align: center;
		}
		
		.icon {
			margin-right: 0;
			margin-bottom: 10px;
		}
	}
</style>
